/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package it.apuliait.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;

import it.apuliait.model.CausalePagamento;
import it.apuliait.model.CausalePagamentoModel;

import java.io.Serializable;

import java.sql.Types;

import java.util.HashMap;
import java.util.Map;

/**
 * The base model implementation for the CausalePagamento service. Represents a row in the &quot;fatturapa_CausalePagamento&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link it.apuliait.model.CausalePagamentoModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link CausalePagamentoImpl}.
 * </p>
 *
 * @author Donatello
 * @see CausalePagamentoImpl
 * @see it.apuliait.model.CausalePagamento
 * @see it.apuliait.model.CausalePagamentoModel
 * @generated
 */
public class CausalePagamentoModelImpl extends BaseModelImpl<CausalePagamento>
	implements CausalePagamentoModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a causale pagamento model instance should use the {@link it.apuliait.model.CausalePagamento} interface instead.
	 */
	public static final String TABLE_NAME = "fatturapa_CausalePagamento";
	public static final Object[][] TABLE_COLUMNS = {
			{ "codiceCausale", Types.VARCHAR },
			{ "descrizione", Types.VARCHAR }
		};
	public static final String TABLE_SQL_CREATE = "create table fatturapa_CausalePagamento (codiceCausale VARCHAR(75) not null primary key,descrizione VARCHAR(3000) null)";
	public static final String TABLE_SQL_DROP = "drop table fatturapa_CausalePagamento";
	public static final String ORDER_BY_JPQL = " ORDER BY causalePagamento.codiceCausale ASC";
	public static final String ORDER_BY_SQL = " ORDER BY fatturapa_CausalePagamento.codiceCausale ASC";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.it.apuliait.model.CausalePagamento"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.it.apuliait.model.CausalePagamento"),
			true);
	public static final boolean COLUMN_BITMASK_ENABLED = false;
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.it.apuliait.model.CausalePagamento"));

	public CausalePagamentoModelImpl() {
	}

	@Override
	public String getPrimaryKey() {
		return _codiceCausale;
	}

	@Override
	public void setPrimaryKey(String primaryKey) {
		setCodiceCausale(primaryKey);
	}

	@Override
	public Serializable getPrimaryKeyObj() {
		return _codiceCausale;
	}

	@Override
	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey((String)primaryKeyObj);
	}

	@Override
	public Class<?> getModelClass() {
		return CausalePagamento.class;
	}

	@Override
	public String getModelClassName() {
		return CausalePagamento.class.getName();
	}

	@Override
	public Map<String, Object> getModelAttributes() {
		Map<String, Object> attributes = new HashMap<String, Object>();

		attributes.put("codiceCausale", getCodiceCausale());
		attributes.put("descrizione", getDescrizione());

		return attributes;
	}

	@Override
	public void setModelAttributes(Map<String, Object> attributes) {
		String codiceCausale = (String)attributes.get("codiceCausale");

		if (codiceCausale != null) {
			setCodiceCausale(codiceCausale);
		}

		String descrizione = (String)attributes.get("descrizione");

		if (descrizione != null) {
			setDescrizione(descrizione);
		}
	}

	@Override
	public String getCodiceCausale() {
		if (_codiceCausale == null) {
			return StringPool.BLANK;
		}
		else {
			return _codiceCausale;
		}
	}

	@Override
	public void setCodiceCausale(String codiceCausale) {
		_codiceCausale = codiceCausale;
	}

	@Override
	public String getDescrizione() {
		if (_descrizione == null) {
			return StringPool.BLANK;
		}
		else {
			return _descrizione;
		}
	}

	@Override
	public void setDescrizione(String descrizione) {
		_descrizione = descrizione;
	}

	@Override
	public CausalePagamento toEscapedModel() {
		if (_escapedModel == null) {
			_escapedModel = (CausalePagamento)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelInterfaces, new AutoEscapeBeanHandler(this));
		}

		return _escapedModel;
	}

	@Override
	public Object clone() {
		CausalePagamentoImpl causalePagamentoImpl = new CausalePagamentoImpl();

		causalePagamentoImpl.setCodiceCausale(getCodiceCausale());
		causalePagamentoImpl.setDescrizione(getDescrizione());

		causalePagamentoImpl.resetOriginalValues();

		return causalePagamentoImpl;
	}

	@Override
	public int compareTo(CausalePagamento causalePagamento) {
		String primaryKey = causalePagamento.getPrimaryKey();

		return getPrimaryKey().compareTo(primaryKey);
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}

		if (!(obj instanceof CausalePagamento)) {
			return false;
		}

		CausalePagamento causalePagamento = (CausalePagamento)obj;

		String primaryKey = causalePagamento.getPrimaryKey();

		if (getPrimaryKey().equals(primaryKey)) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return getPrimaryKey().hashCode();
	}

	@Override
	public void resetOriginalValues() {
	}

	@Override
	public CacheModel<CausalePagamento> toCacheModel() {
		CausalePagamentoCacheModel causalePagamentoCacheModel = new CausalePagamentoCacheModel();

		causalePagamentoCacheModel.codiceCausale = getCodiceCausale();

		String codiceCausale = causalePagamentoCacheModel.codiceCausale;

		if ((codiceCausale != null) && (codiceCausale.length() == 0)) {
			causalePagamentoCacheModel.codiceCausale = null;
		}

		causalePagamentoCacheModel.descrizione = getDescrizione();

		String descrizione = causalePagamentoCacheModel.descrizione;

		if ((descrizione != null) && (descrizione.length() == 0)) {
			causalePagamentoCacheModel.descrizione = null;
		}

		return causalePagamentoCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(5);

		sb.append("{codiceCausale=");
		sb.append(getCodiceCausale());
		sb.append(", descrizione=");
		sb.append(getDescrizione());
		sb.append("}");

		return sb.toString();
	}

	@Override
	public String toXmlString() {
		StringBundler sb = new StringBundler(10);

		sb.append("<model><model-name>");
		sb.append("it.apuliait.model.CausalePagamento");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>codiceCausale</column-name><column-value><![CDATA[");
		sb.append(getCodiceCausale());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>descrizione</column-name><column-value><![CDATA[");
		sb.append(getDescrizione());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = CausalePagamento.class.getClassLoader();
	private static Class<?>[] _escapedModelInterfaces = new Class[] {
			CausalePagamento.class
		};
	private String _codiceCausale;
	private String _descrizione;
	private CausalePagamento _escapedModel;
}